<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>SASAPI</title><script src="../../../quicknav.js" type="text/javascript"></script><script><!--
document.quicknavBasePath="../../../index-files";
//--></script><link href="../../../style.css" title="JavaDoc" rel="stylesheet" type="text/css"/><link href="../../../unnatural.css" title="Unnatural" rel="alternate stylesheet" type="text/css"/><link href="../../../overview-summary.html" title="Overview" rel="top"/><meta name="generator" content="http://www.badgers-in-foil.co.uk/projects/as2api/"/></head><body><pre><span class="lineno" id="1">     1  </span><span class="comment doc">/**
<span class="lineno" id="2">     2  </span> * properties.ColorShortcuts
<span class="lineno" id="3">     3  </span> * List of default special color properties (normal and splitter properties) for the Tweener class
<span class="lineno" id="4">     4  </span> * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways.
<span class="lineno" id="5">     5  </span> *
<span class="lineno" id="6">     6  </span> * @author		Zeh Fernando, Nate Chatellier, Arthur Debert
<span class="lineno" id="7">     7  </span> * @version		1.0.0
<span class="lineno" id="8">     8  </span> */</span>
<span class="lineno" id="9">     9  </span>
<span class="lineno" id="10">    10  </span><span class="key">import</span> flash.geom.ColorTransform;
<span class="lineno" id="11">    11  </span><span class="key">import</span> flash.filters.ColorMatrixFilter;
<span class="lineno" id="12">    12  </span>
<span class="lineno" id="13">    13  </span><span class="key">import</span> caurina.transitions.Tweener;
<span class="lineno" id="14">    14  </span><span class="key">import</span> caurina.transitions.AuxFunctions;
<span class="lineno" id="15">    15  </span>
<span class="lineno" id="16">    16  </span><span class="key">class</span> caurina.transitions.properties.ColorShortcuts {
<span class="lineno" id="17">    17  </span>
<span class="lineno" id="18">    18  </span>	<span class="comment">// Sources:</span>
<span class="lineno" id="19">    19  </span>	<span class="comment">// http://www.graficaobscura.com/matrix/index.html</span>
<span class="lineno" id="20">    20  </span>	<span class="comment">// And mario Klingemann's ColorMatrix class as mentioned on the credits:</span>
<span class="lineno" id="21">    21  </span>	<span class="comment">// http://www.quasimondo.com/archives/000565.php</span>
<span class="lineno" id="22">    22  </span>	
<span class="lineno" id="23">    23  </span>	<span class="comment">// Defines luminance using sRGB luminance</span>
<span class="lineno" id="24">    24  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> LUMINANCE_R:Number = <span class="num_const">0</span>.<span class="num_const">212671</span>;
<span class="lineno" id="25">    25  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> LUMINANCE_G:Number = <span class="num_const">0</span>.<span class="num_const">715160</span>;
<span class="lineno" id="26">    26  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> LUMINANCE_B:Number = <span class="num_const">0</span>.<span class="num_const">072169</span>;
<span class="lineno" id="27">    27  </span>	
<span class="lineno" id="28">    28  </span>	<span class="comment doc">/**
<span class="lineno" id="29">    29  </span>	 * There's no constructor.
<span class="lineno" id="30">    30  </span>	 */</span>
<span class="lineno" id="31">    31  </span>	<span class="key">public</span> <span class="key">function</span> ColorShortcuts () {
<span class="lineno" id="32">    32  </span>		trace (<span class="str_const">"This is an static class and should not be instantiated."</span>)
<span class="lineno" id="33">    33  </span>	}
<span class="lineno" id="34">    34  </span>
<span class="lineno" id="35">    35  </span>	<span class="comment doc">/**
<span class="lineno" id="36">    36  </span>	 * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them.
<span class="lineno" id="37">    37  </span>	 */</span>
<span class="lineno" id="38">    38  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> init():Void {
<span class="lineno" id="39">    39  </span>
<span class="lineno" id="40">    40  </span>		<span class="comment">// Normal properties</span>
<span class="lineno" id="41">    41  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_ra"</span>, _oldColor_property_get, _oldColor_property_set, [<span class="str_const">"ra"</span>]);
<span class="lineno" id="42">    42  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_rb"</span>, _oldColor_property_get, _oldColor_property_set, [<span class="str_const">"rb"</span>]);
<span class="lineno" id="43">    43  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_ga"</span>, _oldColor_property_get, _oldColor_property_set, [<span class="str_const">"ga"</span>]);
<span class="lineno" id="44">    44  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_gb"</span>, _oldColor_property_get, _oldColor_property_set, [<span class="str_const">"gb"</span>]);
<span class="lineno" id="45">    45  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_ba"</span>, _oldColor_property_get, _oldColor_property_set, [<span class="str_const">"ba"</span>]);
<span class="lineno" id="46">    46  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_bb"</span>, _oldColor_property_get, _oldColor_property_set, [<span class="str_const">"bb"</span>]);
<span class="lineno" id="47">    47  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_aa"</span>, _oldColor_property_get, _oldColor_property_set, [<span class="str_const">"aa"</span>]);
<span class="lineno" id="48">    48  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_ab"</span>, _oldColor_property_get, _oldColor_property_set, [<span class="str_const">"ab"</span>]);
<span class="lineno" id="49">    49  </span>
<span class="lineno" id="50">    50  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_redMultiplier"</span>, 	_color_property_get, _color_property_set, [<span class="str_const">"redMultiplier"</span>]);
<span class="lineno" id="51">    51  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_redOffset"</span>,			_color_property_get, _color_property_set, [<span class="str_const">"redOffset"</span>]);
<span class="lineno" id="52">    52  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_greenMultiplier"</span>,	_color_property_get, _color_property_set, [<span class="str_const">"greenMultiplier"</span>]);
<span class="lineno" id="53">    53  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_greenOffset"</span>,		_color_property_get, _color_property_set, [<span class="str_const">"greenOffset"</span>]);
<span class="lineno" id="54">    54  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_blueMultiplier"</span>,	_color_property_get, _color_property_set, [<span class="str_const">"blueMultiplier"</span>]);
<span class="lineno" id="55">    55  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_blueOffset"</span>,		_color_property_get, _color_property_set, [<span class="str_const">"blueOffset"</span>]);
<span class="lineno" id="56">    56  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_alphaMultiplier"</span>,	_color_property_get, _color_property_set, [<span class="str_const">"alphaMultiplier"</span>]);
<span class="lineno" id="57">    57  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_color_alphaOffset"</span>,		_color_property_get, _color_property_set, [<span class="str_const">"alphaOffset"</span>]);
<span class="lineno" id="58">    58  </span>
<span class="lineno" id="59">    59  </span>		<span class="comment">// Normal splitter properties</span>
<span class="lineno" id="60">    60  </span>		Tweener.registerSpecialPropertySplitter(<span class="str_const">"_color"</span>, _color_splitter);
<span class="lineno" id="61">    61  </span>		Tweener.registerSpecialPropertySplitter(<span class="str_const">"_colorTransform"</span>, _colorTransform_splitter);
<span class="lineno" id="62">    62  </span>
<span class="lineno" id="63">    63  </span>		<span class="comment">// Color changes that depend on the ColorMatrixFilter</span>
<span class="lineno" id="64">    64  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_brightness"</span>,		_brightness_get,	_brightness_set, [<span class="key">false</span>]);
<span class="lineno" id="65">    65  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_tintBrightness"</span>,	_brightness_get,	_brightness_set, [<span class="key">true</span>]);
<span class="lineno" id="66">    66  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_contrast"</span>,		_contrast_get,		_contrast_set);
<span class="lineno" id="67">    67  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_hue"</span>,				_hue_get,			_hue_set);
<span class="lineno" id="68">    68  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_saturation"</span>,		_saturation_get,	_saturation_set, [<span class="key">false</span>]);
<span class="lineno" id="69">    69  </span>		Tweener.registerSpecialProperty(<span class="str_const">"_dumbSaturation"</span>,	_saturation_get,	_saturation_set, [<span class="key">true</span>]);
<span class="lineno" id="70">    70  </span>
<span class="lineno" id="71">    71  </span>	}
<span class="lineno" id="72">    72  </span>
<span class="lineno" id="73">    73  </span>
<span class="lineno" id="74">    74  </span>	<span class="comment">// ==================================================================================================================================</span>
<span class="lineno" id="75">    75  </span>	<span class="comment">// PROPERTY GROUPING/SPLITTING functions --------------------------------------------------------------------------------------------</span>
<span class="lineno" id="76">    76  </span>
<span class="lineno" id="77">    77  </span>	<span class="comment">// ----------------------------------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="78">    78  </span>	<span class="comment">// _color</span>
<span class="lineno" id="79">    79  </span>
<span class="lineno" id="80">    80  </span>	<span class="comment doc">/**
<span class="lineno" id="81">    81  </span>	 * Splits the _color parameter into specific color variables
<span class="lineno" id="82">    82  </span>	 *
<span class="lineno" id="83">    83  </span>	 * @param		p_value				Number		The original _color value
<span class="lineno" id="84">    84  </span>	 * @return							Array		An array containing the .name and .value of all new properties
<span class="lineno" id="85">    85  </span>	 */</span>
<span class="lineno" id="86">    86  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _color_splitter (p_value:Number, p_parameters:Array):Array {
<span class="lineno" id="87">    87  </span>		<span class="key">var</span> nArray:Array = <span class="key">new</span> Array();
<span class="lineno" id="88">    88  </span>		<span class="key">if</span> (p_value == <span class="key">null</span>) {
<span class="lineno" id="89">    89  </span>			<span class="comment">// No parameter passed, so just resets the color</span>
<span class="lineno" id="90">    90  </span>			nArray.push({name:<span class="str_const">"_color_redMultiplier"</span>,	value:<span class="num_const">1</span>});
<span class="lineno" id="91">    91  </span>			nArray.push({name:<span class="str_const">"_color_redOffset"</span>,		value:<span class="num_const">0</span>});
<span class="lineno" id="92">    92  </span>			nArray.push({name:<span class="str_const">"_color_greenMultiplier"</span>,	value:<span class="num_const">1</span>});
<span class="lineno" id="93">    93  </span>			nArray.push({name:<span class="str_const">"_color_greenOffset"</span>,		value:<span class="num_const">0</span>});
<span class="lineno" id="94">    94  </span>			nArray.push({name:<span class="str_const">"_color_blueMultiplier"</span>,	value:<span class="num_const">1</span>});
<span class="lineno" id="95">    95  </span>			nArray.push({name:<span class="str_const">"_color_blueOffset"</span>,		value:<span class="num_const">0</span>});
<span class="lineno" id="96">    96  </span>		} <span class="key">else</span> {
<span class="lineno" id="97">    97  </span>			<span class="comment">// A color tinting is passed, so converts it to the object values</span>
<span class="lineno" id="98">    98  </span>			nArray.push({name:<span class="str_const">"_color_redMultiplier"</span>,	value:<span class="num_const">0</span>});
<span class="lineno" id="99">    99  </span>			nArray.push({name:<span class="str_const">"_color_redOffset"</span>,		value:AuxFunctions.numberToR(p_value)});
<span class="lineno" id="100">   100  </span>			nArray.push({name:<span class="str_const">"_color_greenMultiplier"</span>,	value:<span class="num_const">0</span>});
<span class="lineno" id="101">   101  </span>			nArray.push({name:<span class="str_const">"_color_greenOffset"</span>,		value:AuxFunctions.numberToG(p_value)});
<span class="lineno" id="102">   102  </span>			nArray.push({name:<span class="str_const">"_color_blueMultiplier"</span>,	value:<span class="num_const">0</span>});
<span class="lineno" id="103">   103  </span>			nArray.push({name:<span class="str_const">"_color_blueOffset"</span>,		value:AuxFunctions.numberToB(p_value)});
<span class="lineno" id="104">   104  </span>		}
<span class="lineno" id="105">   105  </span>		<span class="key">return</span> nArray;
<span class="lineno" id="106">   106  </span>	}
<span class="lineno" id="107">   107  </span>
<span class="lineno" id="108">   108  </span>
<span class="lineno" id="109">   109  </span>	<span class="comment">// ----------------------------------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="110">   110  </span>	<span class="comment">// _colorTransform</span>
<span class="lineno" id="111">   111  </span>
<span class="lineno" id="112">   112  </span>	<span class="comment doc">/**
<span class="lineno" id="113">   113  </span>	 * Splits the _colorTransform parameter into specific color variables
<span class="lineno" id="114">   114  </span>	 *
<span class="lineno" id="115">   115  </span>	 * @param		p_value				Number		The original _colorTransform value
<span class="lineno" id="116">   116  </span>	 * @return							Array		An array containing the .name and .value of all new properties
<span class="lineno" id="117">   117  </span>	 */</span>
<span class="lineno" id="118">   118  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _colorTransform_splitter (p_value:Object, p_parameters:Array):Array {
<span class="lineno" id="119">   119  </span>		<span class="key">var</span> nArray:Array = <span class="key">new</span> Array();
<span class="lineno" id="120">   120  </span>		<span class="key">if</span> (p_value == <span class="key">null</span>) {
<span class="lineno" id="121">   121  </span>			<span class="comment">// No parameter passed, so just resets the color</span>
<span class="lineno" id="122">   122  </span>			nArray.push({name:<span class="str_const">"_color_redMultiplier"</span>,	value:<span class="num_const">1</span>});
<span class="lineno" id="123">   123  </span>			nArray.push({name:<span class="str_const">"_color_redOffset"</span>,		value:<span class="num_const">0</span>});
<span class="lineno" id="124">   124  </span>			nArray.push({name:<span class="str_const">"_color_greenMultiplier"</span>,	value:<span class="num_const">1</span>});
<span class="lineno" id="125">   125  </span>			nArray.push({name:<span class="str_const">"_color_greenOffset"</span>,		value:<span class="num_const">0</span>});
<span class="lineno" id="126">   126  </span>			nArray.push({name:<span class="str_const">"_color_blueMultiplier"</span>,	value:<span class="num_const">1</span>});
<span class="lineno" id="127">   127  </span>			nArray.push({name:<span class="str_const">"_color_blueOffset"</span>,		value:<span class="num_const">0</span>});
<span class="lineno" id="128">   128  </span>		} <span class="key">else</span> {
<span class="lineno" id="129">   129  </span>			<span class="comment">// A color tinting is passed, so converts it to the object values</span>
<span class="lineno" id="130">   130  </span>			<span class="key">if</span> (p_value.ra != undefined) nArray.push({name:<span class="str_const">"_color_ra"</span>, value:p_value.ra});
<span class="lineno" id="131">   131  </span>			<span class="key">if</span> (p_value.rb != undefined) nArray.push({name:<span class="str_const">"_color_rb"</span>, value:p_value.rb});
<span class="lineno" id="132">   132  </span>			<span class="key">if</span> (p_value.ga != undefined) nArray.push({name:<span class="str_const">"_color_ba"</span>, value:p_value.ba});
<span class="lineno" id="133">   133  </span>			<span class="key">if</span> (p_value.gb != undefined) nArray.push({name:<span class="str_const">"_color_bb"</span>, value:p_value.bb});
<span class="lineno" id="134">   134  </span>			<span class="key">if</span> (p_value.ba != undefined) nArray.push({name:<span class="str_const">"_color_ga"</span>, value:p_value.ga});
<span class="lineno" id="135">   135  </span>			<span class="key">if</span> (p_value.bb != undefined) nArray.push({name:<span class="str_const">"_color_gb"</span>, value:p_value.gb});
<span class="lineno" id="136">   136  </span>			<span class="key">if</span> (p_value.aa != undefined) nArray.push({name:<span class="str_const">"_color_aa"</span>, value:p_value.aa});
<span class="lineno" id="137">   137  </span>			<span class="key">if</span> (p_value.ab != undefined) nArray.push({name:<span class="str_const">"_color_ab"</span>, value:p_value.ab});
<span class="lineno" id="138">   138  </span>			<span class="key">if</span> (p_value.redMultiplier != undefined)		nArray.push({name:<span class="str_const">"_color_redMultiplier"</span>, value:p_value.redMultiplier});
<span class="lineno" id="139">   139  </span>			<span class="key">if</span> (p_value.redOffset != undefined)			nArray.push({name:<span class="str_const">"_color_redOffset"</span>, value:p_value.redOffset});
<span class="lineno" id="140">   140  </span>			<span class="key">if</span> (p_value.blueMultiplier != undefined)	nArray.push({name:<span class="str_const">"_color_blueMultiplier"</span>, value:p_value.blueMultiplier});
<span class="lineno" id="141">   141  </span>			<span class="key">if</span> (p_value.blueOffset != undefined)		nArray.push({name:<span class="str_const">"_color_blueOffset"</span>, value:p_value.blueOffset});
<span class="lineno" id="142">   142  </span>			<span class="key">if</span> (p_value.greenMultiplier != undefined)	nArray.push({name:<span class="str_const">"_color_greenMultiplier"</span>, value:p_value.greenMultiplier});
<span class="lineno" id="143">   143  </span>			<span class="key">if</span> (p_value.greenOffset != undefined)		nArray.push({name:<span class="str_const">"_color_greenOffset"</span>, value:p_value.greenOffset});
<span class="lineno" id="144">   144  </span>			<span class="key">if</span> (p_value.alphaMultiplier != undefined)	nArray.push({name:<span class="str_const">"_color_alphaMultiplier"</span>, value:p_value.alphaMultiplier});
<span class="lineno" id="145">   145  </span>			<span class="key">if</span> (p_value.alphaOffset != undefined)		nArray.push({name:<span class="str_const">"_color_alphaOffset"</span>, value:p_value.alphaOffset});
<span class="lineno" id="146">   146  </span>		}
<span class="lineno" id="147">   147  </span>		<span class="key">return</span> nArray;
<span class="lineno" id="148">   148  </span>	}
<span class="lineno" id="149">   149  </span>
<span class="lineno" id="150">   150  </span>
<span class="lineno" id="151">   151  </span>	<span class="comment">// ==================================================================================================================================</span>
<span class="lineno" id="152">   152  </span>	<span class="comment">// NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="153">   153  </span>
<span class="lineno" id="154">   154  </span>	<span class="comment">// ----------------------------------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="155">   155  </span>	<span class="comment">// _color_*</span>
<span class="lineno" id="156">   156  </span>
<span class="lineno" id="157">   157  </span>	<span class="comment doc">/**
<span class="lineno" id="158">   158  </span>	 * _color_*
<span class="lineno" id="159">   159  </span>	 * Generic function for the ra/rb/etc components of the deprecated colorTransform object
<span class="lineno" id="160">   160  </span>	 */</span>
<span class="lineno" id="161">   161  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _oldColor_property_get (p_obj:Object, p_parameters:Array):Number {
<span class="lineno" id="162">   162  </span>		<span class="key">return</span> (<span class="key">new</span> Color(p_obj)).getTransform()[p_parameters[<span class="num_const">0</span>]];
<span class="lineno" id="163">   163  </span>	}
<span class="lineno" id="164">   164  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _oldColor_property_set (p_obj:Object, p_value:Number, p_parameters:Array):Void {
<span class="lineno" id="165">   165  </span>		<span class="key">var</span> cfObj:Object = <span class="key">new</span> Object();
<span class="lineno" id="166">   166  </span>		cfObj[p_parameters[<span class="num_const">0</span>]] = p_value; <span class="comment">// Math.round(p_value);</span>
<span class="lineno" id="167">   167  </span>		(<span class="key">new</span> Color(p_obj)).setTransform(cfObj);
<span class="lineno" id="168">   168  </span>	}
<span class="lineno" id="169">   169  </span>
<span class="lineno" id="170">   170  </span>	<span class="comment doc">/**
<span class="lineno" id="171">   171  </span>	 * _color_*
<span class="lineno" id="172">   172  </span>	 * Generic function for the redMultiplier/redOffset/etc components of the new colorTransform
<span class="lineno" id="173">   173  </span>	 */</span>
<span class="lineno" id="174">   174  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _color_property_get (p_obj:Object, p_parameters:Array):Number {
<span class="lineno" id="175">   175  </span>		<span class="key">return</span> p_obj.transform.colorTransform[p_parameters[<span class="num_const">0</span>]];
<span class="lineno" id="176">   176  </span>	}
<span class="lineno" id="177">   177  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _color_property_set (p_obj:Object, p_value:Number, p_parameters:Array):Void {
<span class="lineno" id="178">   178  </span>		<span class="key">var</span> cfm:ColorTransform = p_obj.transform.colorTransform;
<span class="lineno" id="179">   179  </span>		cfm[p_parameters[<span class="num_const">0</span>]] = p_value;
<span class="lineno" id="180">   180  </span>		p_obj.transform.colorTransform = cfm;
<span class="lineno" id="181">   181  </span>	}
<span class="lineno" id="182">   182  </span>
<span class="lineno" id="183">   183  </span>	<span class="comment">// ----------------------------------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="184">   184  </span>	<span class="comment">// Special coloring</span>
<span class="lineno" id="185">   185  </span>
<span class="lineno" id="186">   186  </span>	<span class="comment doc">/**
<span class="lineno" id="187">   187  </span>	 * _brightness
<span class="lineno" id="188">   188  </span>	 * Brightness of an object: -1 -&gt; [0] -&gt; +1
<span class="lineno" id="189">   189  </span>	 */</span>
<span class="lineno" id="190">   190  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _brightness_get (p_obj:Object, p_parameters:Array):Number {
<span class="lineno" id="191">   191  </span>
<span class="lineno" id="192">   192  </span>		<span class="key">var</span> isTint:Boolean = p_parameters[<span class="num_const">0</span>];
<span class="lineno" id="193">   193  </span>
<span class="lineno" id="194">   194  </span>		<span class="comment">/*
<span class="lineno" id="195">   195  </span>		// Using ColorMatrix:
<span class="lineno" id="196">   196  </span>		
<span class="lineno" id="197">   197  </span>		var mtx:Array = getObjectMatrix(p_obj);
<span class="lineno" id="198">   198  </span>		
<span class="lineno" id="199">   199  </span>		var mc:Number = 1 - ((mtx[0] + mtx[6] + mtx[12]) / 3); // Brightness as determined by the main channels
<span class="lineno" id="200">   200  </span>		var co:Number = (mtx[4] + mtx[9] + mtx[14]) / 3; // Brightness as determined by the offset channels
<span class="lineno" id="201">   201  </span>		*/</span>
<span class="lineno" id="202">   202  </span>
<span class="lineno" id="203">   203  </span>		<span class="key">var</span> cfm:Object = (<span class="key">new</span> Color(p_obj)).getTransform();
<span class="lineno" id="204">   204  </span>		<span class="key">var</span> mc:Number = <span class="num_const">1</span> - ((cfm.ra + cfm.ga + cfm.ba) / <span class="num_const">300</span>); <span class="comment">// Brightness as determined by the main channels</span>
<span class="lineno" id="205">   205  </span>		<span class="key">var</span> co:Number = (cfm.rb + cfm.gb + cfm.bb) / <span class="num_const">3</span>;
<span class="lineno" id="206">   206  </span>
<span class="lineno" id="207">   207  </span>		<span class="key">if</span> (isTint) {
<span class="lineno" id="208">   208  </span>			<span class="comment">// Tint style</span>
<span class="lineno" id="209">   209  </span>			<span class="key">return</span> co &gt; <span class="num_const">0</span> ? co / <span class="num_const">255</span> : -mc;
<span class="lineno" id="210">   210  </span>		} <span class="key">else</span> {
<span class="lineno" id="211">   211  </span>			<span class="comment">// Native, Flash "Adjust Color" and Photoshop style</span>
<span class="lineno" id="212">   212  </span>			<span class="key">return</span> co / <span class="num_const">100</span>;
<span class="lineno" id="213">   213  </span>		}
<span class="lineno" id="214">   214  </span>	}
<span class="lineno" id="215">   215  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _brightness_set (p_obj:Object, p_value:Number, p_parameters:Array):Void {
<span class="lineno" id="216">   216  </span>		<span class="comment">//var mtx:Array = getObjectMatrix(p_obj);</span>
<span class="lineno" id="217">   217  </span>
<span class="lineno" id="218">   218  </span>		<span class="key">var</span> isTint:Boolean = p_parameters[<span class="num_const">0</span>];
<span class="lineno" id="219">   219  </span>
<span class="lineno" id="220">   220  </span>		<span class="key">var</span> mc:Number; <span class="comment">// Main channel</span>
<span class="lineno" id="221">   221  </span>		<span class="key">var</span> co:Number; <span class="comment">// Channel offset</span>
<span class="lineno" id="222">   222  </span>
<span class="lineno" id="223">   223  </span>		<span class="key">if</span> (isTint) {
<span class="lineno" id="224">   224  </span>			<span class="comment">// Tint style</span>
<span class="lineno" id="225">   225  </span>			mc = <span class="num_const">1</span> - Math.abs(p_value);
<span class="lineno" id="226">   226  </span>			co = p_value &gt; <span class="num_const">0</span> ? Math.round(p_value*<span class="num_const">255</span>) : <span class="num_const">0</span>;
<span class="lineno" id="227">   227  </span>		} <span class="key">else</span> {
<span class="lineno" id="228">   228  </span>			<span class="comment">// Native, Flash "Adjust Color" and Photoshop style</span>
<span class="lineno" id="229">   229  </span>			mc = <span class="num_const">1</span>;
<span class="lineno" id="230">   230  </span>			co = Math.round(p_value*<span class="num_const">100</span>);
<span class="lineno" id="231">   231  </span>		}
<span class="lineno" id="232">   232  </span>
<span class="lineno" id="233">   233  </span>		<span class="comment">/*
<span class="lineno" id="234">   234  </span>		// Using ColorMatrix:
<span class="lineno" id="235">   235  </span>		var mtx:Array = [
<span class="lineno" id="236">   236  </span>			mc, cc, cc, cc, co,
<span class="lineno" id="237">   237  </span>			cc, mc, cc, cc, co,
<span class="lineno" id="238">   238  </span>			cc, cc, mc, cc, co,
<span class="lineno" id="239">   239  </span>			0,  0,  0,  1,  0
<span class="lineno" id="240">   240  </span>		];
<span class="lineno" id="241">   241  </span>		setObjectMatrix(p_obj, mtx);
<span class="lineno" id="242">   242  </span>		*/</span>
<span class="lineno" id="243">   243  </span>		<span class="key">var</span> cfm:Object = {ra:mc * <span class="num_const">100</span>, rb:co, ga:mc * <span class="num_const">100</span>, gb:co, ba:mc * <span class="num_const">100</span>, bb:co};
<span class="lineno" id="244">   244  </span>		(<span class="key">new</span> Color(p_obj)).setTransform(cfm);
<span class="lineno" id="245">   245  </span>	}
<span class="lineno" id="246">   246  </span>
<span class="lineno" id="247">   247  </span>	<span class="comment doc">/**
<span class="lineno" id="248">   248  </span>	 * _saturation
<span class="lineno" id="249">   249  </span>	 * Saturation of an object: 0 -&gt; [1] -&gt; 2
<span class="lineno" id="250">   250  </span>	 */</span>
<span class="lineno" id="251">   251  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _saturation_get (p_obj:Object, p_parameters:Array):Number {
<span class="lineno" id="252">   252  </span>
<span class="lineno" id="253">   253  </span>		<span class="key">var</span> mtx:Array = getObjectMatrix(p_obj);
<span class="lineno" id="254">   254  </span>
<span class="lineno" id="255">   255  </span>		<span class="key">var</span> isDumb:Boolean = p_parameters[<span class="num_const">0</span>];
<span class="lineno" id="256">   256  </span>		<span class="key">var</span> rl:Number = isDumb ? <span class="num_const">1</span>/<span class="num_const">3</span> : LUMINANCE_R;
<span class="lineno" id="257">   257  </span>		<span class="key">var</span> gl:Number = isDumb ? <span class="num_const">1</span>/<span class="num_const">3</span> : LUMINANCE_G;
<span class="lineno" id="258">   258  </span>		<span class="key">var</span> bl:Number = isDumb ? <span class="num_const">1</span>/<span class="num_const">3</span> : LUMINANCE_B;
<span class="lineno" id="259">   259  </span>
<span class="lineno" id="260">   260  </span>		<span class="key">var</span> mc:Number = ((mtx[<span class="num_const">0</span>]-rl)/(<span class="num_const">1</span>-rl) + (mtx[<span class="num_const">6</span>]-gl)/(<span class="num_const">1</span>-gl) + (mtx[<span class="num_const">12</span>]-bl)/(<span class="num_const">1</span>-bl)) / <span class="num_const">3</span>;					<span class="comment">// Color saturation as determined by the main channels</span>
<span class="lineno" id="261">   261  </span>		<span class="key">var</span> cc:Number = <span class="num_const">1</span> - ((mtx[<span class="num_const">1</span>]/gl + mtx[<span class="num_const">2</span>]/bl + mtx[<span class="num_const">5</span>]/rl + mtx[<span class="num_const">7</span>]/bl + mtx[<span class="num_const">10</span>]/rl + mtx[<span class="num_const">11</span>]/gl) / <span class="num_const">6</span>);	<span class="comment">// Color saturation as determined by the other channels</span>
<span class="lineno" id="262">   262  </span>		<span class="key">return</span> (mc + cc) / <span class="num_const">2</span>;
<span class="lineno" id="263">   263  </span>	}
<span class="lineno" id="264">   264  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _saturation_set (p_obj:Object, p_value:Number, p_parameters:Array):Void {
<span class="lineno" id="265">   265  </span>		
<span class="lineno" id="266">   266  </span>		<span class="key">var</span> isDumb:Boolean = p_parameters[<span class="num_const">0</span>];
<span class="lineno" id="267">   267  </span>		<span class="key">var</span> rl:Number = isDumb ? <span class="num_const">1</span>/<span class="num_const">3</span> : LUMINANCE_R;
<span class="lineno" id="268">   268  </span>		<span class="key">var</span> gl:Number = isDumb ? <span class="num_const">1</span>/<span class="num_const">3</span> : LUMINANCE_G;
<span class="lineno" id="269">   269  </span>		<span class="key">var</span> bl:Number = isDumb ? <span class="num_const">1</span>/<span class="num_const">3</span> : LUMINANCE_B;
<span class="lineno" id="270">   270  </span>
<span class="lineno" id="271">   271  </span>		<span class="key">var</span> sf:Number = p_value;
<span class="lineno" id="272">   272  </span>		<span class="key">var</span> nf:Number = <span class="num_const">1</span>-sf;
<span class="lineno" id="273">   273  </span>		<span class="key">var</span> nr:Number = rl * nf;
<span class="lineno" id="274">   274  </span>		<span class="key">var</span> ng:Number = gl * nf;
<span class="lineno" id="275">   275  </span>		<span class="key">var</span> nb:Number = bl * nf;
<span class="lineno" id="276">   276  </span>
<span class="lineno" id="277">   277  </span>		<span class="key">var</span> mtx:Array = [
<span class="lineno" id="278">   278  </span>			nr+sf,	ng,		nb,		<span class="num_const">0</span>,	<span class="num_const">0</span>,
<span class="lineno" id="279">   279  </span>			nr,		ng+sf,	nb,		<span class="num_const">0</span>,	<span class="num_const">0</span>,
<span class="lineno" id="280">   280  </span>			nr,		ng,		nb+sf,	<span class="num_const">0</span>,	<span class="num_const">0</span>,
<span class="lineno" id="281">   281  </span>			<span class="num_const">0</span>,  	<span class="num_const">0</span>, 		<span class="num_const">0</span>,  	<span class="num_const">1</span>,  <span class="num_const">0</span>
<span class="lineno" id="282">   282  </span>		];
<span class="lineno" id="283">   283  </span>		setObjectMatrix(p_obj, mtx);
<span class="lineno" id="284">   284  </span>	}
<span class="lineno" id="285">   285  </span>
<span class="lineno" id="286">   286  </span>	<span class="comment doc">/**
<span class="lineno" id="287">   287  </span>	 * _contrast
<span class="lineno" id="288">   288  </span>	 * Contrast of an object: -1 -&gt; [0] -&gt; +1
<span class="lineno" id="289">   289  </span>	 */</span>
<span class="lineno" id="290">   290  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _contrast_get (p_obj:Object, p_parameters:Array):Number {
<span class="lineno" id="291">   291  </span>
<span class="lineno" id="292">   292  </span>		<span class="comment">/*
<span class="lineno" id="293">   293  </span>		// Using ColorMatrix:
<span class="lineno" id="294">   294  </span>		var mtx:Array = getObjectMatrix(p_obj);
<span class="lineno" id="295">   295  </span>
<span class="lineno" id="296">   296  </span>		var mc:Number = ((mtx[0] + mtx[6] + mtx[12]) / 3) - 1;		// Contrast as determined by the main channels
<span class="lineno" id="297">   297  </span>		var co:Number = (mtx[4] + mtx[9] + mtx[14]) / 3 / -128;		// Contrast as determined by the offset channel
<span class="lineno" id="298">   298  </span>		*/</span>
<span class="lineno" id="299">   299  </span>		<span class="key">var</span> cfm:Object = (<span class="key">new</span> Color(p_obj)).getTransform();
<span class="lineno" id="300">   300  </span>		<span class="key">var</span> mc:Number;	<span class="comment">// Contrast as determined by the main channels</span>
<span class="lineno" id="301">   301  </span>		<span class="key">var</span> co:Number;	<span class="comment">// Contrast as determined by the offset channel</span>
<span class="lineno" id="302">   302  </span>		mc = ((cfm.ra + cfm.ga + cfm.ba) / <span class="num_const">300</span>) - <span class="num_const">1</span>;
<span class="lineno" id="303">   303  </span>		co = (cfm.rb + cfm.gb + cfm.bb) / <span class="num_const">3</span> / -<span class="num_const">128</span>;
<span class="lineno" id="304">   304  </span>		<span class="comment">/*
<span class="lineno" id="305">   305  </span>		if (cfm.ra &lt; 100) {
<span class="lineno" id="306">   306  </span>			// Low contrast
<span class="lineno" id="307">   307  </span>			mc = ((cfm.ra + cfm.ga + cfm.ba) / 300) - 1;
<span class="lineno" id="308">   308  </span>			co = (cfm.rb + cfm.gb + cfm.bb) / 3 / -128;
<span class="lineno" id="309">   309  </span>		} else {
<span class="lineno" id="310">   310  </span>			// High contrast
<span class="lineno" id="311">   311  </span>			mc = (((cfm.ra + cfm.ga + cfm.ba) / 300) - 1) / 37;
<span class="lineno" id="312">   312  </span>			co = (cfm.rb + cfm.gb + cfm.bb) / 3 / -3840;
<span class="lineno" id="313">   313  </span>		}
<span class="lineno" id="314">   314  </span>		*/</span>
<span class="lineno" id="315">   315  </span>
<span class="lineno" id="316">   316  </span>		<span class="key">return</span> (mc+co)/<span class="num_const">2</span>;
<span class="lineno" id="317">   317  </span>	}
<span class="lineno" id="318">   318  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _contrast_set (p_obj:Object, p_value:Number, p_parameters:Array):Void {
<span class="lineno" id="319">   319  </span>		
<span class="lineno" id="320">   320  </span>		<span class="key">var</span> mc:Number;	<span class="comment">// Main channel</span>
<span class="lineno" id="321">   321  </span>		<span class="key">var</span> co:Number;	<span class="comment">// Channel offset</span>
<span class="lineno" id="322">   322  </span>		mc = p_value + <span class="num_const">1</span>;
<span class="lineno" id="323">   323  </span>		co = Math.round(p_value*-<span class="num_const">128</span>);
<span class="lineno" id="324">   324  </span>
<span class="lineno" id="325">   325  </span>		<span class="comment">/*
<span class="lineno" id="326">   326  </span>		if (p_value &lt; 0) {
<span class="lineno" id="327">   327  </span>			// Low contrast
<span class="lineno" id="328">   328  </span>			mc = p_value + 1;
<span class="lineno" id="329">   329  </span>			co = Math.round(p_value*-128);
<span class="lineno" id="330">   330  </span>		} else {
<span class="lineno" id="331">   331  </span>			// High contrast
<span class="lineno" id="332">   332  </span>			mc = (p_value * 37) + 1;
<span class="lineno" id="333">   333  </span>			co = Math.round(p_value*-3840);
<span class="lineno" id="334">   334  </span>		}
<span class="lineno" id="335">   335  </span>		*/</span>
<span class="lineno" id="336">   336  </span>		
<span class="lineno" id="337">   337  </span>		<span class="comment">// Flash: * 8, * -512</span>
<span class="lineno" id="338">   338  </span>
<span class="lineno" id="339">   339  </span>		<span class="comment">/*
<span class="lineno" id="340">   340  </span>		// Using ColorMatrix:
<span class="lineno" id="341">   341  </span>		var mtx:Array = [
<span class="lineno" id="342">   342  </span>			mc,	0,	0, 	0, co,
<span class="lineno" id="343">   343  </span>			0,	mc,	0, 	0, co,
<span class="lineno" id="344">   344  </span>			0,	0,	mc,	0, co,
<span class="lineno" id="345">   345  </span>			0,  0, 	0, 	1,  0
<span class="lineno" id="346">   346  </span>		];
<span class="lineno" id="347">   347  </span>		setObjectMatrix(p_obj, mtx);
<span class="lineno" id="348">   348  </span>		*/</span>
<span class="lineno" id="349">   349  </span>		<span class="key">var</span> cfm:Object = {ra:mc * <span class="num_const">100</span>, rb:co, ga:mc * <span class="num_const">100</span>, gb:co, ba:mc * <span class="num_const">100</span>, bb:co};
<span class="lineno" id="350">   350  </span>		(<span class="key">new</span> Color(p_obj)).setTransform(cfm);
<span class="lineno" id="351">   351  </span>	}
<span class="lineno" id="352">   352  </span>
<span class="lineno" id="353">   353  </span>	<span class="comment doc">/**
<span class="lineno" id="354">   354  </span>	 * _hue
<span class="lineno" id="355">   355  </span>	 * Hue of an object: -180 -&gt; [0] -&gt; 180
<span class="lineno" id="356">   356  </span>	 */</span>
<span class="lineno" id="357">   357  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _hue_get (p_obj:Object, p_parameters:Array):Number {
<span class="lineno" id="358">   358  </span>
<span class="lineno" id="359">   359  </span>		<span class="key">var</span> mtx:Array = getObjectMatrix(p_obj);
<span class="lineno" id="360">   360  </span>
<span class="lineno" id="361">   361  </span>		<span class="comment">// Find the current Hue based on a given matrix.</span>
<span class="lineno" id="362">   362  </span>		<span class="comment">// This is a kind of a brute force method by sucessive division until a close enough angle is found.</span>
<span class="lineno" id="363">   363  </span>		<span class="comment">// Reverse-engineering the hue equation would be is a better choice, but it's hard to find material</span>
<span class="lineno" id="364">   364  </span>		<span class="comment">// on the correct calculation employed by Flash.</span>
<span class="lineno" id="365">   365  </span>		<span class="comment">// This code has to run only once (before the tween starts), so it's good enough.</span>
<span class="lineno" id="366">   366  </span>
<span class="lineno" id="367">   367  </span>		<span class="key">var</span> hues:Array = [];
<span class="lineno" id="368">   368  </span>		hues[<span class="num_const">0</span>] = {angle:-<span class="num_const">179</span>.<span class="num_const">9</span>, matrix:getHueMatrix(-<span class="num_const">179</span>.<span class="num_const">9</span>)};
<span class="lineno" id="369">   369  </span>		hues[<span class="num_const">1</span>] = {angle:<span class="num_const">180</span>, matrix:getHueMatrix(<span class="num_const">180</span>)};
<span class="lineno" id="370">   370  </span>	
<span class="lineno" id="371">   371  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; hues.length; i++) {
<span class="lineno" id="372">   372  </span>			hues[i].distance = getHueDistance(mtx, hues[i].matrix);
<span class="lineno" id="373">   373  </span>		}
<span class="lineno" id="374">   374  </span>
<span class="lineno" id="375">   375  </span>		<span class="key">var</span> maxTries:Number = <span class="num_const">15</span>;	<span class="comment">// Number o maximum divisions until the hue is found</span>
<span class="lineno" id="376">   376  </span>		<span class="key">var</span> angleToSplit:Number;
<span class="lineno" id="377">   377  </span>
<span class="lineno" id="378">   378  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; maxTries; i++) {
<span class="lineno" id="379">   379  </span>			<span class="comment">// Find the nearest angle</span>
<span class="lineno" id="380">   380  </span>			<span class="key">if</span> (hues[<span class="num_const">0</span>].distance &lt; hues[<span class="num_const">1</span>].distance) {
<span class="lineno" id="381">   381  </span>				<span class="comment">// First is closer</span>
<span class="lineno" id="382">   382  </span>				angleToSplit = <span class="num_const">1</span>;
<span class="lineno" id="383">   383  </span>			} <span class="key">else</span> {
<span class="lineno" id="384">   384  </span>				<span class="comment">// Second is closer</span>
<span class="lineno" id="385">   385  </span>				angleToSplit = <span class="num_const">0</span>;
<span class="lineno" id="386">   386  </span>			}
<span class="lineno" id="387">   387  </span>			hues[angleToSplit].angle = (hues[<span class="num_const">0</span>].angle + hues[<span class="num_const">1</span>].angle)/<span class="num_const">2</span>;
<span class="lineno" id="388">   388  </span>			hues[angleToSplit].matrix = getHueMatrix(hues[angleToSplit].angle)
<span class="lineno" id="389">   389  </span>			hues[angleToSplit].distance = getHueDistance(mtx, hues[angleToSplit].matrix);
<span class="lineno" id="390">   390  </span>		}
<span class="lineno" id="391">   391  </span>
<span class="lineno" id="392">   392  </span>		<span class="key">return</span> hues[angleToSplit].angle;
<span class="lineno" id="393">   393  </span>	}
<span class="lineno" id="394">   394  </span>
<span class="lineno" id="395">   395  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> _hue_set (p_obj:Object, p_value:Number, p_parameters:Array):Void {
<span class="lineno" id="396">   396  </span>		setObjectMatrix(p_obj, getHueMatrix(p_value));
<span class="lineno" id="397">   397  </span>	}
<span class="lineno" id="398">   398  </span>
<span class="lineno" id="399">   399  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getHueDistance (mtx1:Array, mtx2:Array): Number {
<span class="lineno" id="400">   400  </span>		<span class="key">return</span> (Math.abs(mtx1[<span class="num_const">0</span>] - mtx2[<span class="num_const">0</span>]) + Math.abs(mtx1[<span class="num_const">1</span>] - mtx2[<span class="num_const">1</span>]) + Math.abs(mtx1[<span class="num_const">2</span>] - mtx2[<span class="num_const">2</span>]));
<span class="lineno" id="401">   401  </span>	}
<span class="lineno" id="402">   402  </span>
<span class="lineno" id="403">   403  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getHueMatrix (hue:Number): Array {
<span class="lineno" id="404">   404  </span>		<span class="key">var</span> ha:Number = hue * Math.PI/<span class="num_const">180</span>;		<span class="comment">// Hue angle, to radians</span>
<span class="lineno" id="405">   405  </span>
<span class="lineno" id="406">   406  </span> 		<span class="key">var</span> rl:Number = LUMINANCE_R;
<span class="lineno" id="407">   407  </span>		<span class="key">var</span> gl:Number = LUMINANCE_G;
<span class="lineno" id="408">   408  </span>		<span class="key">var</span> bl:Number = LUMINANCE_B;
<span class="lineno" id="409">   409  </span>
<span class="lineno" id="410">   410  </span>		<span class="key">var</span> c:Number = Math.cos(ha);
<span class="lineno" id="411">   411  </span>		<span class="key">var</span> s:Number = Math.sin(ha);
<span class="lineno" id="412">   412  </span>
<span class="lineno" id="413">   413  </span>		<span class="key">var</span> mtx:Array = [
<span class="lineno" id="414">   414  </span>			(rl + (c * (<span class="num_const">1</span> - rl))) + (s * (-rl)),
<span class="lineno" id="415">   415  </span>			(gl + (c * (-gl))) + (s * (-gl)),
<span class="lineno" id="416">   416  </span>			(bl + (c * (-bl))) + (s * (<span class="num_const">1</span> - bl)),
<span class="lineno" id="417">   417  </span>			<span class="num_const">0</span>, <span class="num_const">0</span>,
<span class="lineno" id="418">   418  </span>
<span class="lineno" id="419">   419  </span>			(rl + (c * (-rl))) + (s * <span class="num_const">0</span>.<span class="num_const">143</span>),
<span class="lineno" id="420">   420  </span>			(gl + (c * (<span class="num_const">1</span> - gl))) + (s * <span class="num_const">0</span>.<span class="num_const">14</span>),
<span class="lineno" id="421">   421  </span>			(bl + (c * (-bl))) + (s * -<span class="num_const">0</span>.<span class="num_const">283</span>),
<span class="lineno" id="422">   422  </span>			<span class="num_const">0</span>, <span class="num_const">0</span>,
<span class="lineno" id="423">   423  </span>
<span class="lineno" id="424">   424  </span>			(rl + (c * (-rl))) + (s * (-(<span class="num_const">1</span> - rl))),
<span class="lineno" id="425">   425  </span>			(gl + (c * (-gl))) + (s * gl),
<span class="lineno" id="426">   426  </span>			(bl + (c * (<span class="num_const">1</span> - bl))) + (s * bl),
<span class="lineno" id="427">   427  </span>			<span class="num_const">0</span>, <span class="num_const">0</span>,
<span class="lineno" id="428">   428  </span>
<span class="lineno" id="429">   429  </span>			<span class="num_const">0</span>, <span class="num_const">0</span>, <span class="num_const">0</span>, <span class="num_const">1</span>, <span class="num_const">0</span>
<span class="lineno" id="430">   430  </span>		];
<span class="lineno" id="431">   431  </span>		
<span class="lineno" id="432">   432  </span>		<span class="key">return</span> mtx;
<span class="lineno" id="433">   433  </span>	}
<span class="lineno" id="434">   434  </span>
<span class="lineno" id="435">   435  </span>
<span class="lineno" id="436">   436  </span>	<span class="comment">// ==================================================================================================================================</span>
<span class="lineno" id="437">   437  </span>	<span class="comment">// AUXILIARY functions --------------------------------------------------------------------------------------------------------------</span>
<span class="lineno" id="438">   438  </span>
<span class="lineno" id="439">   439  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">function</span> getObjectMatrix(p_obj:Object): Array {
<span class="lineno" id="440">   440  </span>		<span class="comment">// Get the current color matrix of an object</span>
<span class="lineno" id="441">   441  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; p_obj.filters.length; i++) {
<span class="lineno" id="442">   442  </span>			<span class="key">if</span> (p_obj.filters[i] <span class="key">instanceof</span> ColorMatrixFilter) {
<span class="lineno" id="443">   443  </span>				<span class="key">return</span> p_obj.filters[i].matrix.concat();
<span class="lineno" id="444">   444  </span>			}
<span class="lineno" id="445">   445  </span>		}
<span class="lineno" id="446">   446  </span>		<span class="key">return</span> [
<span class="lineno" id="447">   447  </span>			<span class="num_const">1</span>, <span class="num_const">0</span>, <span class="num_const">0</span>, <span class="num_const">0</span>, <span class="num_const">0</span>,
<span class="lineno" id="448">   448  </span>			<span class="num_const">0</span>, <span class="num_const">1</span>, <span class="num_const">0</span>, <span class="num_const">0</span>, <span class="num_const">0</span>,
<span class="lineno" id="449">   449  </span>			<span class="num_const">0</span>, <span class="num_const">0</span>, <span class="num_const">1</span>, <span class="num_const">0</span>, <span class="num_const">0</span>,
<span class="lineno" id="450">   450  </span>			<span class="num_const">0</span>, <span class="num_const">0</span>, <span class="num_const">0</span>, <span class="num_const">1</span>, <span class="num_const">0</span>
<span class="lineno" id="451">   451  </span>		];
<span class="lineno" id="452">   452  </span>	}
<span class="lineno" id="453">   453  </span>
<span class="lineno" id="454">   454  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">function</span> setObjectMatrix(p_obj:Object, p_matrix:Array): Void {
<span class="lineno" id="455">   455  </span>		<span class="comment">// Set the current color matrix of an object</span>
<span class="lineno" id="456">   456  </span>		<span class="key">var</span> objFilters:Array = p_obj.filters.concat();
<span class="lineno" id="457">   457  </span>		<span class="key">var</span> found:Boolean = <span class="key">false</span>;
<span class="lineno" id="458">   458  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; objFilters.length; i++) {
<span class="lineno" id="459">   459  </span>			<span class="key">if</span> (objFilters[i] <span class="key">instanceof</span> ColorMatrixFilter) {
<span class="lineno" id="460">   460  </span>				objFilters[i].matrix = p_matrix.concat();
<span class="lineno" id="461">   461  </span>				found = <span class="key">true</span>;
<span class="lineno" id="462">   462  </span>			}
<span class="lineno" id="463">   463  </span>		}
<span class="lineno" id="464">   464  </span>		<span class="key">if</span> (!found) {
<span class="lineno" id="465">   465  </span>			<span class="comment">// Has to create a new color matrix filter</span>
<span class="lineno" id="466">   466  </span>			<span class="key">var</span> cmtx:ColorMatrixFilter = <span class="key">new</span> ColorMatrixFilter(p_matrix);
<span class="lineno" id="467">   467  </span>			objFilters[objFilters.length] = cmtx;
<span class="lineno" id="468">   468  </span>		}
<span class="lineno" id="469">   469  </span>		p_obj.filters = objFilters;
<span class="lineno" id="470">   470  </span>	}
<span class="lineno" id="471">   471  </span>}
<span class="lineno" id="472">   472  </span></pre><ul class="main_nav" id="main_nav"><li><a href="../../../overview-summary.html" title="Overview of SASAPI" class="button">Overview</a></li><li><a href="package-summary.html" title="Overview of package caurina.transitions.properties" class="button">Package</a></li><li><a href="ColorShortcuts.html" title="Detail of caurina.transitions.properties.ColorShortcuts API" class="button">Class</a></li><li><span class="button nav_current">Source</span></li><li><a href="../../../index-files/index.html" title="Alpabetical index of types and members" class="button">Index</a></li></ul><div class="footer"><a href="http://www.badgers-in-foil.co.uk/projects/as2api/" title="ActionScript 2 API Documentation Generator">as2api</a></div></body></html>